package com.hmy.contract.commons.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

public enum AuthorizerEnum {
    ;

    /**
     * 授权变更单据状态
     */
    @AllArgsConstructor
    @Getter
    public enum Status {

        DRAFT(10, "草稿"),

        REVOKE(20, "已撤销"),

        TO_APPROVE(30, "审批中"),

        REJECT(40, "已驳回"),

        FINISH(50, "已通过"),

        CANCEL(60, "已作废");

        public final Integer status;

        public final String describe;

        /**
         * 根据状态获取中文描述
         *
         * @param status 单据状态
         * @return 中文描述
         */
        public static String getDesc(Integer status) {
            for (Status s : Status.values()) {
                if (status.equals(s.status)) {
                    return s.describe;
                }
            }
            return null;
        }
    }

    /**
     * 审批节点子状态
     */
    @AllArgsConstructor
    @Getter
    public enum SubStatus {

        TO_AREA_MANAGER_APPROVE(31, "待区域经理审批"),

        TO_RISK_MANAGER_APPROVE(32, "待风控部长审批"),

        AREA_MANAGER_REJECT(33, "区域经理驳回"),

        TO_RISK_MANAGER_REJECT(34, "风控部长驳回");

        public final Integer subStatus;

        public final String describe;

        /**
         * 根据状态获取中文描述
         *
         * @param subsStatus 审批节点子状态
         * @return 中文描述
         */
        public static String getDesc(Integer subsStatus) {
            for (SubStatus status : SubStatus.values()) {
                if (subsStatus.equals(status.subStatus)) {
                    return status.describe;
                }
            }
            return null;
        }
    }

    @AllArgsConstructor
    @Getter
    public enum ApproveResult {

        REJECT(0, "reject", "驳回"),

        PASS(1, "agree", "通过");

        public final Integer result;

        public final String code;

        public final String alias;
    }

    /**
     * 授权变更操作类型
     */
    @AllArgsConstructor
    @Getter
    public enum OperateType {

        ADD("新增授权人信息"),

        DELETE("删除授权人信息"),

        UPDATE("修改授权人信息");

        public final String operate;
    }


}
